<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>Layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="../../layuiAdmin/layui/css/layui.css" media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
  <style>
    .margin-top {
      margin-top: 20px;
    }

    .h1 {
      font-size: 20px;
      /* padding-left: 50px; */
    }

    .layui-form-label {
      white-space: nowrap;
    }

    .height {
      height: 20px;
    }
  </style>
</head>


<body style="background-color: #fff;">

  <div class="layui-fluid">
    <div class="layui-card margin-top">
      <div class="layui-card-header h1">排查录入</div>
      <!-- layui-card-body -->
      <div class="height"></div>
      <div class="">
        <form class="layui-form" action="">
          <!-- 行 -->
          <div class="layui-form-item">
            <div class="layui-inline">
              <label for="" class="layui-form-label">排查名称</label>
              <div class="layui-input-block">
                <input type="text" class="layui-input">
              </div>
            </div>
            <div class="layui-inline">
              <label for="" class="layui-form-label">排查日期</label>
              <div class="layui-input-block">
                <input type="text" class="layui-input" id="date">
              </div>
            </div>
            <div class="layui-inline">
              <!-- <label for="a" class="layui-form-label">包含删除</label> -->
              <div class="layui-input-block">
                <input type="checkbox" id="a" name="like1[write]" lay-skin="primary" title="包含删除" checked="">
              </div>
            </div>
            <div class="layui-inline">
              <button type="button" class="layui-btn  layui-btn-radius layui-btn-sm">
                <i class="layui-icon">&#xe615;</i> 查询
              </button>
            </div>

          </div>
        </form>
      </div>
    </div>
    <table class="layui-hide" id="test" lay-filter="test"></table>
  </div>

  <script type="text/html" id="toolbarDemo">
  <div class="layui-btn-container">
    <button class="layui-btn layui-btn-sm" lay-event="add"> <i class="layui-icon">&#xe615;</i> 新建</button>
    <button class="layui-btn layui-btn-sm" lay-event="getCheckLength"> <i class="layui-icon">&#xe615;</i> 编辑</button>
    <button class="layui-btn layui-btn-sm" lay-event="isAll"> <i class="layui-icon">&#xe615;</i> 继续排查</button>
  </div>
</script>

  <script type="text/html" id="barDemo">
    <!-- <a class="layui-btn layui-btn-xs" lay-event="edit">显示</a> -->
  <!-- <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a> -->
  <a class="layui-btn layui-btn-sm layui-btn-xs" lay-event="sel">排查</a>
  </script>


  <script src="../../layuiAdmin/layui/layui.all.js" charset="utf-8"></script>
  <!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->

  <script>
    layui.use(['form', 'layedit', 'laydate', 'table'], function () {
      var table = layui.table
        , form = layui.form
        , layer = layui.layer
        , layedit = layui.layedit
        , laydate = layui.laydate;
      //日期
      laydate.render({
        elem: '#date'
      });
      table.render({
        elem: '#test'
        , url: '/js/table.json'
        , toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
        , defaultToolbar: ['filter', 'exports', 'print',]//{ //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
        //   title: '提示'
        //   , layEvent: 'LAYTABLE_TIPS'
        //   , icon: 'layui-icon-tips'
        // }
        , title: '用户数据表'
        , cols: [[
          { type: 'numbers', fixed: 'left' },
          { type: 'checkbox', fixed: 'left' }
          , { field: 'id', title: 'ID', width: 80, fixed: 'left', unresize: true, sort: true, hide: true }
          , { field: 'card', title: '档案卡名称', width: 120, fixed: 'left', unresize: true, sort: true }
          , { field: 'jc', title: '负责人', width: 120, edit: 'text' }
          , , { field: 'data', title: '排查日期', width: 100 }
          , { field: 'address', title: '地点', edit: 'text' }
          , {
            field: 'bumen', title: '部门', width: 150, edit: 'text'
          }
          , { fixed: 'right', title: '录入排查卡', align: 'center', toolbar: '#barDemo' } //这里的toolbar值是模板元素的选择器
          , { field: 'status', title: '排查状态', edit: 'text', sort: true }
          , { field: 'sfdbld', title: '是否删除', edit: 'text', sort: true }

        ]]
        , page: true
      });

      //头工具栏事件
      table.on('toolbar(test)', function (obj) {
        var checkStatus = table.checkStatus(obj.config.id);
        switch (obj.event) {
          case 'add':
            //新建
            layer.open({
              type: 2,
              zIndex: layer.zIndex, //重点1
              title: '新建排查表',
              shadeClose: true,
              // shade: true,
              maxmin: false, //开启最大化最小化按钮
              area: ['60%', '90%'],
              content: '/page/隐患/隐患录入.html',
              success: function (layero) {
                //layer.setTop(layero); //重点2
              },
              end: function () {
                window.location.reload();
              }

            });
            break;
          case 'getCheckLength':
            var data = checkStatus.data;
            layer.msg('选中了：' + data.length + ' 个');
            break;
          case 'isAll':
            layer.msg(checkStatus.isAll ? '全选' : '未全选');
            break;

          //自定义头工具栏右侧图标 - 提示
          case 'LAYTABLE_TIPS':
            layer.alert('这是工具栏右侧自定义的一个图标按钮');
            break;
        };
      });

      //监听行工具事件
      table.on('tool(test)', function (obj) {
        var data = obj.data;
        if (obj.event === 'sel') {
          //排查
          layer.open({
            type: 2,
            zIndex: layer.zIndex, //重点1
            title: '排查',
            shadeClose: true,
            // shade: true,
            maxmin: false, //开启最大化最小化按钮
            area: ['100%', '100%'],
            content: '/page/排查/排查.html',
            success: function (layero) {
              //layer.setTop(layero); //重点2
            },
            end: function () {
              // window.location.reload();
            }

          });
        }
      });
    });
  </script>

</body>

</html>